/*************************************************************************
	> File Name: factory.h
	> Author: ma6174
	> Mail: ma6174@163.com 
	> Created Time: 2021年11月24日 星期三 20时55分23秒
 ************************************************************************/

#include<iostream>
#include "symbol.h"

class IFactory
{
public:
	virtual Operation* create(double a, double b) = 0;
};

class AddFactory : public IFactory
{
public:
	virtual Operation* create(double a, double b)
	{
		return new Add(a, b);
	}
};

class SubFactory : public IFactory
{
public:
	virtual Operation* create(double a, double b)
	{
		return new Sub(a, b);
	}
};

class MulFactory : public IFactory
{
public:
	virtual Operation* create(double a, double b)
	{
		return new Mul(a, b);
	}
};

class DivFactory : public IFactory
{
public:
	virtual Operation* create(double a, double b)
	{
		return new Div(a, b);
	}
};
